home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / libs / objeas3a / workshop / actions.cpp next >
C/C++ Source or Header  |  1994-05-18  |  30KB  |  1,423 lines

  1. #include "d:\gui\gui.h"
  2. #include "workshop.h"
  3. #include <alloc.h>
  4. #include <stdlib.h>
  5. #include <conio.h>
  6.  
  7. //*********************************************************************
  8. //        PROTOTYPES
  9. //*********************************************************************
  10.  
  11. void set_screen_color();
  12. void place_panel();
  13. void place_bevel();
  14. void place_radio();
  15. void place_icon();
  16. void place_string();
  17. void place_button();
  18. void place_line();
  19. void place_text();
  20.  
  21. extern void redraw_screen();
  22. extern void showmem();
  23.  
  24. //*********************************************************************
  25. //        GLOBAL VARIABLES
  26. //*********************************************************************
  27.  
  28. extern Screen screen;
  29. extern Buttonbox toolbox;
  30.  
  31. extern panelrec *panelroot;
  32. extern panelrec *currentpanel;
  33. extern int numpanels;
  34.  
  35. extern bevelrec *bevelroot;
  36. extern bevelrec *currentbevel;
  37. extern int numbevels;
  38.  
  39. extern checkboxrec *checkboxroot;
  40. extern checkboxrec *currentcheckbox;
  41. extern int numcheckboxes;
  42.  
  43. extern Mcursor the_mouse;
  44. extern int screencolor;
  45.  
  46. extern radiorec *radioroot;
  47. extern radiorec *currentradio;
  48. extern int numradios;
  49.  
  50. extern iconrec *iconroot;
  51. extern iconrec *currenticon;
  52. extern int numicons;
  53.  
  54. extern stringrec *stringroot;
  55. extern stringrec *currentstring;
  56. extern int numstrings;
  57.  
  58. extern buttonrec *buttonroot;
  59. extern buttonrec *currentbutton;
  60. extern int numbuttons;
  61.  
  62. extern Line line_info[100];
  63. extern int numlines;
  64.  
  65. extern textrec *textroot;
  66. extern textrec *currenttext;
  67. extern int numtexts;
  68.  
  69. //*********************************************************************
  70. //        SETSCREENCOLOR
  71. //*********************************************************************
  72.  
  73. void set_screen_color()
  74. {
  75.     Bevel box;
  76.     Gstring colornum;
  77.     static int c=screencolor;
  78.     Colorbutton cb[16];
  79.     int i;
  80.     Button OK;
  81.     int ready=0;
  82.  
  83.  
  84.     box.init(200,100,200,70,THICK,SAVEBGD);
  85.     box.setbevelcolor(3);
  86.     box.show();
  87.     for(i=0;i<16;i++) {
  88.         cb[i].init((10*i)+220,120,10,10,i);
  89.         cb[i].show(0);
  90.         }
  91.     cb[c].show(15);
  92.     OK.init(270,140,"  OK  ",TEXT);
  93.     OK.show();
  94.  
  95.     while(!ready) {
  96.         if(the_mouse.LBP()) {
  97.             for(i=0;i<16;i++) {
  98.                 if(cb[i].hit()) {
  99.                     cb[c].show(0);
  100.                     cb[i].show(15);
  101.                     c=i;
  102.                     while(the_mouse.LBP());
  103.                     break;
  104.                     }
  105.                 }
  106.             if(OK.hit()) {
  107.                 OK.press();
  108.                 while(the_mouse.LBP() && OK.hit());
  109.                 OK.show();
  110.                 if(OK.hit())
  111.                     ready=1;
  112.                 }
  113.             }
  114.         }
  115.     screencolor=c;
  116.     redraw_screen();
  117. }
  118.  
  119. //*********************************************************************
  120. //        PLACE_PANEL
  121. //*********************************************************************
  122.  
  123. void place_panel()
  124. {
  125.     int ready=0;
  126.     showmem();
  127.  
  128.     Bevel box;
  129.     box.init(173,140,289,199,THICK,SAVEBGD);
  130.     box.setbevelcolor(3);
  131.     box.show();
  132.  
  133.     Panel panel1;
  134.     panel1.init(192,232,130,48,IN,THIN);
  135.     Panel panel2;
  136.     panel2.init(191,290,253,30,IN,THIN);
  137.     Panel panel3;
  138.     panel3.init(337,232,107,49,IN,THIN);
  139.     panel1.show();
  140.     panel2.show();
  141.     panel3.show();
  142.  
  143.     Button OK;
  144.     OK.init(233,295,"  OK  ",TEXT);
  145.     Button button1;
  146.     button1.init(403,152,"PANEL",IMAGE);
  147.     Button CANCEL;
  148.     CANCEL.init(345,295,"CANCEL",TEXT);
  149.     OK.show();
  150.     button1.show();
  151.     CANCEL.show();
  152.  
  153.     Gstring name;
  154.     name.init(267,211,20,0);
  155.     name.show();
  156.  
  157.     Gradio thick;
  158.     thick.init(208,239,"Thick");
  159.     Gradio thin;
  160.     thin.init(208,262,"Thin");
  161.     Gradio in;
  162.     in.init(355,239,"In");
  163.     Gradio out;
  164.     out.init(355,262,"Out");
  165.     thick.show();
  166.     thin.show();
  167.     thick.check();
  168.     in.show();
  169.     out.show();
  170.     in.check();
  171.  
  172.     Gtext text1;
  173.     text1.init(204,207,"Name:",0,3,1);
  174.     Gtext text2;
  175.     text2.init(283,160,"New Panel",15,3,1);
  176.     text1.show();
  177.     text2.show();
  178.  
  179.     Line lines[2];
  180.     lines[0].init(188,183,450,183,8,1);
  181.     lines[1].init(450,184,189,184,15,1);
  182.     for(int numlines=0;numlines<2;numlines++)
  183.         lines[numlines].show();
  184.  
  185.     name.get_form_mouse_input();
  186.     if(name.escapehit()) {
  187.         redraw_screen();
  188.         return;
  189.         }
  190.  
  191.     while(!ready) {
  192.         if(kbhit()) {
  193.             char ch=getch();
  194.             if(ch==13) {
  195.                 ready=1;
  196.                 continue;
  197.                 }
  198.             if(ch==27) {
  199.                 redraw_screen();
  200.                 return;
  201.                 }
  202.             }
  203.         if(the_mouse.LBP()) {
  204.             if(name.hit()) {
  205.                 while(the_mouse.LBP());
  206.                 name.get_form_mouse_input();
  207.                 }
  208.             if(in.hit()) {
  209.                 if(!in.is_checked()) {
  210.                     in.check();
  211.                     out.uncheck();
  212.                     while(the_mouse.LBP());
  213.                     }
  214.                 }
  215.             if(out.hit()) {
  216.                 if(!out.is_checked()) {
  217.                     out.check();
  218.                     in.uncheck();
  219.                     while(the_mouse.LBP());
  220.                     }
  221.                 }
  222.             if(thick.hit()) {
  223.                 if(!thick.is_checked()) {
  224.                     thick.check();
  225.                     thin.uncheck();
  226.                     while(the_mouse.LBP());
  227.                     }
  228.                 }
  229.             if(thin.hit()) {
  230.                 if(!thin.is_checked()) {
  231.                     thin.check();
  232.                     thick.uncheck();
  233.                     while(the_mouse.LBP());
  234.                     }
  235.                 }
  236.             if(OK.hit()) {
  237.                 OK.press();
  238.                 while(the_mouse.LBP() && OK.hit());
  239.                 OK.show();
  240.                 if(OK.hit())
  241.                     ready=1;
  242.                 box.hide();
  243.                 box.elim();
  244.                 showmem();
  245.                 }
  246.             if(CANCEL.hit()) {
  247.                 CANCEL.press();
  248.                 while(the_mouse.LBP() && CANCEL.hit());
  249.                 CANCEL.show();
  250.                 if(CANCEL.hit()) {
  251.                     box.hide();
  252.                     box.elim();
  253.                     showmem();
  254.                     redraw_screen();
  255.                     return;
  256.                     }
  257.                 }
  258.             }
  259.         }
  260.     showmem();
  261.     if(panelroot==(panelrec *)NULL) {
  262.         panelroot=new panelrec;
  263.         panelroot->previous=panelroot->next=(panelrec *)NULL;
  264.         panelroot->panel=new Panel;
  265.         currentpanel=panelroot;
  266.         }
  267.     else {
  268.         currentpanel=panelroot;
  269.         while(currentpanel->next!=(panelrec *)NULL)
  270.             currentpanel=currentpanel->next;
  271.         currentpanel->next=new panelrec;
  272.         currentpanel->next->previous=currentpanel;
  273.         currentpanel->next->next=(panelrec *)NULL;
  274.         currentpanel=currentpanel->next;
  275.         currentpanel->panel=new Panel;
  276.         }
  277.     strcpy(currentpanel->name,name.getstring());
  278.  
  279.     the_mouse.changeto(CROSSHAIR);
  280.  
  281.     while(!the_mouse.LBP());
  282.     int mx=the_mouse.mx();
  283.     int my=the_mouse.my();
  284.     currentpanel->panel->init(mx,my,20,20,!in.is_checked(),!thick.is_checked(),SAVEBGD);
  285.     currentpanel->panel->show();
  286.     numpanels++;
  287. }
  288.  
  289. //*********************************************************************
  290. //        PLACE_BEVEL
  291. //*********************************************************************
  292.  
  293. void place_bevel()
  294. {
  295.     int ready=0;
  296.  
  297.     Bevel box;
  298.     box.init(173,141,290,152,THICK,SAVEBGD);
  299.     box.setbevelcolor(3);
  300.     box.show();
  301.  
  302.     Panel panel1;
  303.     panel1.init(192,232,101,48,IN,THIN);
  304.     Panel panel2;
  305.     panel2.init(305,232,137,48,IN,THIN);
  306.     panel1.show();
  307.     panel2.show();
  308.  
  309.     Button OK;
  310.     OK.init(311,246,"  OK  ",TEXT);
  311.     Button button1;
  312.     button1.init(403,152,"BEVEL",IMAGE);
  313.     Button CANCEL;
  314.     CANCEL.init(379,246,"CANCEL",TEXT);
  315.     OK.show();
  316.     button1.show();
  317.     CANCEL.show();
  318.  
  319.     Gstring name;
  320.     name.init(267,211,20,0);
  321.     name.show();
  322.  
  323.     Gradio thick;
  324.     thick.init(208,239,"Thick");
  325.     Gradio thin;
  326.     thin.init(208,262,"Thin");
  327.     thick.show();
  328.     thin.show();
  329.     thick.check();
  330.  
  331.     Gtext text1;
  332.     text1.init(204,207,"Name:",0,3,1);
  333.     Gtext text2;
  334.     text2.init(283,160,"New Bevel",15,3,1);
  335.     text1.show();
  336.     text2.show();
  337.  
  338.     Line lines[2];
  339.     lines[0].init(188,183,450,183,8,1);
  340.     lines[1].init(450,184,189,184,15,1);
  341.     for(int numlines=0;numlines<2;numlines++)
  342.         lines[numlines].show();
  343.  
  344.     while(!ready) {
  345.         name.get_form_mouse_input();
  346.         if(name.escapehit()) {
  347.             redraw_screen();
  348.             return;
  349.             }
  350.         if(the_mouse.LBP()) {
  351.             if(thick.hit()) {
  352.                 if(!thick.is_checked()) {
  353.                     thick.check();
  354.                     thin.uncheck();
  355.                     while(the_mouse.LBP());
  356.                     }
  357.                 }
  358.             if(thin.hit()) {
  359.                 if(!thin.is_checked()) {
  360.                     thin.check();
  361.                     thick.uncheck();
  362.                     while(the_mouse.LBP());
  363.                     }
  364.                 }
  365.             if(OK.hit()) {
  366.                 OK.press();
  367.                 while(the_mouse.LBP() && OK.hit());
  368.                 OK.show();
  369.                 if(OK.hit()) {
  370.                     box.hide();
  371.                     box.elim();
  372.                     ready=1;
  373.                     }
  374.                 }
  375.             if(CANCEL.hit()) {
  376.                 CANCEL.press();
  377.                 while(the_mouse.LBP() && CANCEL.hit());
  378.                 CANCEL.show();
  379.                 if(CANCEL.hit()) {
  380.                     box.hide();
  381.                     box.elim();
  382.                     return;
  383.                     }
  384.                 }
  385.             }
  386.         }
  387.     if(bevelroot==(bevelrec *)NULL) {
  388.         bevelroot=new bevelrec;
  389.         bevelroot->previous=bevelroot->next=(bevelrec *)NULL;
  390.         bevelroot->bevel=new Bevel;
  391.         currentbevel=bevelroot;
  392.         }
  393.     else {
  394.         currentbevel=bevelroot;
  395.         while(currentbevel->next!=(bevelrec *)NULL)
  396.             currentbevel=currentbevel->next;
  397.         currentbevel->next=new bevelrec;
  398.         currentbevel->next->previous=currentbevel;
  399.         currentbevel->next->next=(bevelrec *)NULL;
  400.         currentbevel=currentbevel->next;
  401.         currentbevel->bevel=new Bevel;
  402.         }
  403.     strcpy(currentbevel->name,name.getstring());
  404.  
  405.     the_mouse.changeto(CROSSHAIR);
  406.  
  407.     while(!the_mouse.LBP());
  408.     int mx=the_mouse.mx();
  409.     int my=the_mouse.my();
  410.     currentbevel->bevel->init(mx,my,20,20,!thick.is_checked(),SAVEBGD);
  411.     currentbevel->bevel->show();
  412.     numbevels++;
  413. }
  414.  
  415. //*********************************************************************
  416. //        PLACE_CHECKBOX
  417. //*********************************************************************
  418.  
  419. void place_checkbox()
  420. {
  421.     int ready=0;
  422.  
  423.     Bevel box;
  424.     box.init(160,177,318,158,THICK,SAVEBGD);
  425.     box.setbevelcolor(3);
  426.     box.show();
  427.  
  428.     Panel panel1;
  429.     panel1.init(180,289,279,32,IN,THIN);
  430.     panel1.show();
  431.  
  432.     Button button1;
  433.     button1.init(442,188,"CHECK",IMAGE);
  434.     Button OK;
  435.     OK.init(217,295,"   OK   ",TEXT);
  436.     Button CANCEL;
  437.     CANCEL.init(350,295," CANCEL ",TEXT);
  438.     button1.show();
  439.     OK.show();
  440.     CANCEL.show();
  441.  
  442.     Gstring name;
  443.     name.init(288,242,20,0);
  444.     Gstring cont;
  445.     cont.init(288,270,20,0);
  446.     name.show();
  447.     cont.show();
  448.  
  449.     Gtext text1;
  450.     text1.init(271,195,"New Checkbox",15,3,1);
  451.     Gtext text2;
  452.     text2.init(226,239,"Name:",0,3,1);
  453.     Gtext text3;
  454.     text3.init(195,266,"Contents:",0,3,1);
  455.     text1.show();
  456.     text2.show();
  457.     text3.show();
  458.  
  459.     Line lines[2];
  460.     lines[0].init(172,218,463,218,8,1);
  461.     lines[1].init(172,219,462,219,15,1);
  462.     for(int numlines=0;numlines<2;numlines++)
  463.         lines[numlines].show();
  464.  
  465.     name.get_form_mouse_input();
  466.     if(name.escapehit()) {
  467.         redraw_screen();
  468.         return;
  469.         }
  470.  
  471.     cont.get_form_mouse_input();
  472.     if(cont.escapehit()) {
  473.         redraw_screen();
  474.         return;
  475.         }
  476.  
  477.     while(!ready) {
  478.         if(the_mouse.LBP()) {
  479.             if(name.hit()) {
  480.                 while(the_mouse.LBP());
  481.                 name.get_form_mouse_input();
  482.                 if(name.escapehit()) {
  483.                     redraw_screen();
  484.                     return;
  485.                     }
  486.                 }
  487.             if(cont.hit()) {
  488.                 while(the_mouse.LBP());
  489.                 cont.get_form_mouse_input();
  490.                 if(cont.escapehit()) {
  491.                     redraw_screen();
  492.                     return;
  493.                     }
  494.                 }
  495.             if(OK.hit()) {
  496.                 OK.press();
  497.                 while(the_mouse.LBP() && OK.hit());
  498.                 OK.show();
  499.                 if(OK.hit()) {
  500.                     ready=1;
  501.                     box.hide();
  502.                     box.elim();
  503.                     continue;
  504.                     }
  505.                 }
  506.             if(CANCEL.hit()) {
  507.                 CANCEL.press();
  508.                 while(the_mouse.LBP() && CANCEL.hit());
  509.                 CANCEL.show();
  510.                 if(CANCEL.hit()) {
  511.                     box.hide();
  512.                     box.elim();
  513.                     return;
  514.                     }
  515.                 }
  516.             }
  517.         }
  518.     if(checkboxroot==(checkboxrec *)NULL) {
  519.         checkboxroot=new checkboxrec;
  520.         checkboxroot->previous=checkboxroot->next=(checkboxrec *)NULL;
  521.         checkboxroot->checkbox=new Gcheckbox;
  522.         currentcheckbox=checkboxroot;
  523.         }
  524.     else {
  525.         currentcheckbox=checkboxroot;
  526.         while(currentcheckbox->next!=(checkboxrec *)NULL)
  527.             currentcheckbox=currentcheckbox->next;
  528.         currentcheckbox->next=new checkboxrec;
  529.         currentcheckbox->next->previous=currentcheckbox;
  530.         currentcheckbox->next->next=(checkboxrec *)NULL;
  531.         currentcheckbox=currentcheckbox->next;
  532.         currentcheckbox->checkbox=new Gcheckbox;
  533.         }
  534.  
  535.     strcpy(currentcheckbox->name,name.getstring());
  536.     strcpy(currentcheckbox->text,cont.getstring());
  537.  
  538.     the_mouse.changeto(CROSSHAIR);
  539.  
  540.     while(!the_mouse.LBP());
  541.     int mx=the_mouse.mx();
  542.     int my=the_mouse.my();
  543.     currentcheckbox->checkbox->init(mx,my,cont.getstring(),SAVEBGD);
  544.     currentcheckbox->checkbox->show();
  545.     numcheckboxes++;
  546. }
  547.  
  548. //*********************************************************************
  549. //        PLACE_RADIO
  550. //*********************************************************************
  551.  
  552. void place_radio()
  553. {
  554.     int ready=0;
  555.  
  556.     Bevel box;
  557.     box.init(160,177,318,158,THICK,SAVEBGD);
  558.     box.setbevelcolor(3);
  559.     box.show();
  560.  
  561.     Panel panel1;
  562.     panel1.init(180,289,279,32,IN,THIN);
  563.     panel1.show();
  564.  
  565.     Button button1;
  566.     button1.init(442,188,"RADIO",IMAGE);
  567.     Button OK;
  568.     OK.init(217,295,"   OK   ",TEXT);
  569.     Button CANCEL;
  570.     CANCEL.init(350,295," CANCEL ",TEXT);
  571.     button1.show();
  572.     OK.show();
  573.     CANCEL.show();
  574.  
  575.     Gstring name;
  576.     name.init(288,242,20,0);
  577.     Gstring cont;
  578.     cont.init(288,270,20,0);
  579.     name.show();
  580.     cont.show();
  581.  
  582.     Gtext text1;
  583.     text1.init(255,195,"New Radio Button",15,3,1);
  584.     Gtext text2;
  585.     text2.init(226,239,"Name:",0,3,1);
  586.     Gtext text3;
  587.     text3.init(195,266,"Contents:",0,3,1);
  588.     text1.show();
  589.     text2.show();
  590.     text3.show();
  591.  
  592.     Line lines[2];
  593.     lines[0].init(172,218,463,218,8,1);
  594.     lines[1].init(172,219,462,219,15,1);
  595.     for(int numlines=0;numlines<2;numlines++)
  596.         lines[numlines].show();
  597.  
  598.     name.get_form_mouse_input();
  599.     if(name.escapehit()) {
  600.         redraw_screen();
  601.         return;
  602.         }
  603.     cont.get_form_mouse_input();
  604.     if(cont.escapehit()) {
  605.         redraw_screen();
  606.         return;
  607.         }
  608.  
  609.     while(!ready) {
  610.         if(the_mouse.LBP()) {
  611.             if(name.hit()) {
  612.                 while(the_mouse.LBP());
  613.                 name.get_form_mouse_input();
  614.                 if(name.escapehit()) {
  615.                     redraw_screen();
  616.                     return;
  617.                     }
  618.                 }
  619.             if(cont.hit()) {
  620.                 while(the_mouse.LBP());
  621.                 cont.get_form_mouse_input();
  622.                 if(cont.escapehit()) {
  623.                     redraw_screen();
  624.                     return;
  625.                     }
  626.                 }
  627.             if(OK.hit()) {
  628.                 OK.press();
  629.                 while(the_mouse.LBP() && OK.hit());
  630.                 OK.show();
  631.                 if(OK.hit()) {
  632.                     ready=1;
  633.                     box.hide();
  634.                     box.elim();
  635.                     continue;
  636.                     }
  637.                 }
  638.             if(CANCEL.hit()) {
  639.                 CANCEL.press();
  640.                 while(the_mouse.LBP() && CANCEL.hit());
  641.                 CANCEL.show();
  642.                 if(CANCEL.hit()) {
  643.                     box.hide();
  644.                     box.elim();
  645.                     return;
  646.                     }
  647.                 }
  648.             }
  649.         }
  650.     if(radioroot==(radiorec *)NULL) {
  651.         radioroot=new radiorec;
  652.         radioroot->previous=radioroot->next=(radiorec *)NULL;
  653.         radioroot->radio=new Gradio;
  654.         currentradio=radioroot;
  655.         }
  656.     else {
  657.         currentradio=radioroot;
  658.         while(currentradio->next!=(radiorec *)NULL)
  659.             currentradio=currentradio->next;
  660.         currentradio->next=new radiorec;
  661.         currentradio->next->previous=currentradio;
  662.         currentradio->next->next=(radiorec *)NULL;
  663.         currentradio=currentradio->next;
  664.         currentradio->radio=new Gradio;
  665.         }
  666.  
  667.     strcpy(currentradio->name,name.getstring());
  668.     strcpy(currentradio->text,cont.getstring());
  669.  
  670.     the_mouse.changeto(CROSSHAIR);
  671.  
  672.     while(!the_mouse.LBP());
  673.     int mx=the_mouse.mx();
  674.     int my=the_mouse.my();
  675.     currentradio->radio->init(mx,my,cont.getstring(),SAVEBGD);
  676.     currentradio->radio->show();
  677.     numradios++;
  678. }
  679.  
  680. //*********************************************************************
  681. //        PLACE_ICON
  682. //*********************************************************************
  683.  
  684. void place_icon()
  685. {
  686.     int ready=0;
  687.  
  688.     Bevel box;
  689.     box.init(160,177,318,158,THICK,SAVEBGD);
  690.     box.setbevelcolor(3);
  691.     box.show();
  692.  
  693.     Panel panel1;
  694.     panel1.init(180,289,279,32,IN,THIN);
  695.     panel1.show();
  696.  
  697.     Button button1;
  698.     button1.init(442,188,"icon",IMAGE);
  699.     Button OK;
  700.     OK.init(217,295,"   OK   ",TEXT);
  701.     Button CANCEL;
  702.     CANCEL.init(350,295," CANCEL ",TEXT);
  703.     button1.show();
  704.     OK.show();
  705.     CANCEL.show();
  706.  
  707.     Gstring name;
  708.     name.init(288,242,20,0);
  709.     Gstring cont;
  710.     cont.init(288,270,20,0);
  711.     name.show();
  712.     cont.show();
  713.  
  714.     Gtext text1;
  715.     text1.init(287,195,"New Icon",15,3,1);
  716.     Gtext text2;
  717.     text2.init(226,239,"Name:",0,3,1);
  718.     Gtext text3;
  719.     text3.init(195,266,"Contents:",0,3,1);
  720.     text1.show();
  721.     text2.show();
  722.     text3.show();
  723.  
  724.     Line lines[2];
  725.     lines[0].init(172,218,463,218,8,1);
  726.     lines[1].init(172,219,462,219,15,1);
  727.     for(int numlines=0;numlines<2;numlines++)
  728.         lines[numlines].show();
  729.  
  730.     name.get_form_mouse_input();
  731.     if(name.escapehit()) {
  732.         redraw_screen();
  733.         return;
  734.         }
  735.     cont.get_form_mouse_input();
  736.     if(cont.escapehit()) {
  737.         redraw_screen();
  738.         return;
  739.         }
  740.  
  741.     while(!ready) {
  742.         if(name.hit()) {
  743.             while(the_mouse.LBP());
  744.             name.get_form_mouse_input();
  745.             if(name.escapehit()) {
  746.                 redraw_screen();
  747.                 return;
  748.                 }
  749.             }
  750.         if(cont.hit()) {
  751.             while(the_mouse.LBP());
  752.             cont.get_form_mouse_input();
  753.             if(cont.escapehit()) {
  754.                 redraw_screen();
  755.                 return;
  756.                 }
  757.             }
  758.         if(OK.hit()) {
  759.             OK.press();
  760.             while(the_mouse.LBP() && OK.hit());
  761.             OK.show();
  762.             if(OK.hit()) {
  763.                 ready=1;
  764.                 box.hide();
  765.                 box.elim();
  766.                 continue;
  767.                 }
  768.             }
  769.         if(CANCEL.hit()) {
  770.             CANCEL.press();
  771.             while(the_mouse.LBP() && CANCEL.hit());
  772.             CANCEL.show();
  773.             if(CANCEL.hit()) {
  774.                 box.hide();
  775.                 box.elim();
  776.                 return;
  777.                 }
  778.             }
  779.         }
  780.     if(iconroot==(iconrec *)NULL) {
  781.         iconroot=new iconrec;
  782.         iconroot->previous=iconroot->next=(iconrec *)NULL;
  783.         iconroot->icon=new Icon;
  784.         currenticon=iconroot;
  785.         }
  786.     else {
  787.         currenticon=iconroot;
  788.         while(currenticon->next!=(iconrec *)NULL)
  789.             currenticon=currenticon->next;
  790.         currenticon->next=new iconrec;
  791.         currenticon->next->previous=currenticon;
  792.         currenticon->next->next=(iconrec *)NULL;
  793.         currenticon=currenticon->next;
  794.         currenticon->icon=new Icon;
  795.         }
  796.  
  797.     strcpy(currenticon->name,name.getstring());
  798.     strcpy(currenticon->filename,cont.getstring());
  799.  
  800.     the_mouse.changeto(CROSSHAIR);
  801.  
  802.     while(!the_mouse.LBP());
  803.     int mx=the_mouse.mx();
  804.     int my=the_mouse.my();
  805.     showmem();
  806.     currenticon->icon->init(mx,my,cont.getstring(),SAVEBGD);
  807.     showmem();
  808.     currenticon->icon->
  809.     show();
  810.     numicons++;
  811. }
  812.  
  813. //*********************************************************************
  814. //        PLACE_STRING
  815. //*********************************************************************
  816.  
  817. void place_string()
  818. {
  819.     int ready=0;
  820.  
  821.     Bevel box;
  822.     box.init(169,171,301,167,THICK,SAVEBGD);
  823.     box.setbevelcolor(3);
  824.     box.show();
  825.  
  826.     Panel panel1;
  827.     panel1.init(347,261,103,60,IN,THIN);
  828.     panel1.show();
  829.  
  830.     Button button1;
  831.     button1.init(430,184,"gstring",IMAGE);
  832.     Button OK;
  833.     OK.init(370,267,"  OK  ",TEXT);
  834.     Button CANCEL;
  835.     CANCEL.init(371,295,"CANCEL",TEXT);
  836.     button1.show();
  837.     OK.show();
  838.     CANCEL.show();
  839.  
  840.     Gstring name;
  841.     name.init(283,241,20,0);
  842.     Gstring len;
  843.     len.init(283,268,2,0);
  844.     name.show();
  845.     len.show();
  846.  
  847.     Gcheckbox upper;
  848.     upper.init(199,300,"Uppercase?");
  849.     upper.setbgd(3);
  850.     upper.show();
  851.  
  852.     Gtext text1;
  853.     text1.init(275,189,"New Gstring",15,3,1);
  854.     Gtext text2;
  855.     text2.init(213,237,"Name:",0,3,1);
  856.     Gtext text3;
  857.     text3.init(198,265,"Length:",0,3,1);
  858.     text1.show();
  859.     text2.show();
  860.     text3.show();
  861.  
  862.     Line lines[2];
  863.     lines[0].init(184,216,453,216,8,1);
  864.     lines[1].init(184,217,452,217,15,1);
  865.     for(int numlines=0;numlines<2;numlines++)
  866.         lines[numlines].show();
  867.  
  868.     name.get_form_mouse_input();
  869.     if(name.escapehit()) {
  870.         redraw_screen();
  871.         return;
  872.         }
  873.  
  874.  
  875.     len.get_form_mouse_input();
  876.     if(len.escapehit()) {
  877.         redraw_screen();
  878.         return;
  879.         }
  880.  
  881.  
  882.     while(!ready) {
  883.         if(the_mouse.LBP()) {
  884.             if(name.hit()) {
  885.                 while(the_mouse.LBP());
  886.                 name.get_form_mouse_input();
  887.                 }
  888.             if(len.hit()) {
  889.                 while(the_mouse.LBP());
  890.                 len.get_form_mouse_input();
  891.                 }
  892.             if(upper.hit()) {
  893.                 if(upper.is_checked())
  894.                     upper.uncheck();
  895.                 else
  896.                     upper.check();
  897.                 while(the_mouse.LBP());
  898.                 }
  899.             if(OK.hit()) {
  900.                 OK.press();
  901.                 while(the_mouse.LBP() && OK.hit());
  902.                 OK.show();
  903.                 if(OK.hit()) {
  904.                     box.hide();
  905.                     box.elim();
  906.                     ready=1;
  907.                     }
  908.                 }
  909.             if(CANCEL.hit()) {
  910.                 CANCEL.press();
  911.                 while(the_mouse.LBP() && CANCEL.hit());
  912.                 CANCEL.show();
  913.                 if(CANCEL.hit()) {
  914.                     box.hide();
  915.                     box.elim();
  916.                     return;
  917.                     }
  918.                 }
  919.             }
  920.         }
  921.     if(stringroot==(stringrec *)NULL) {
  922.         stringroot=new stringrec;
  923.         stringroot->previous=stringroot->next=(stringrec *)NULL;
  924.         stringroot->string=new Gstring;
  925.         currentstring=stringroot;
  926.         }
  927.     else {
  928.         currentstring=stringroot;
  929.         while(currentstring->next!=(stringrec *)NULL)
  930.             currentstring=currentstring->next;
  931.         currentstring->next=new stringrec;
  932.         currentstring->next->previous=currentstring;
  933.         currentstring->next->next=(stringrec *)NULL;
  934.         currentstring=currentstring->next;
  935.         currentstring->string=new Gstring;
  936.         }
  937.  
  938.     strcpy(currentstring->name,name.getstring());
  939.     currentstring->length=atoi(len.getstring());
  940.  
  941.     the_mouse.changeto(CROSSHAIR);
  942.  
  943.     while(!the_mouse.LBP());
  944.     int mx=the_mouse.mx();
  945.     int my=the_mouse.my();
  946.     currentstring->string->init(mx,my,atoi(len.getstring()),upper.is_checked(),SAVEBGD);
  947.     currentstring->string->show();
  948.     numstrings++;
  949. }
  950.  
  951. //*********************************************************************
  952. //        PLACE_BUTTON
  953. //*********************************************************************
  954.  
  955. void place_button()
  956. {
  957.     int ready=0;
  958.  
  959.     Bevel box;
  960.     box.init(175,148,288,183,THICK,SAVEBGD);
  961.     box.setbevelcolor(3);
  962.     box.show();
  963.  
  964.     Panel panel1;
  965.     panel1.init(192,266,85,50,IN,THIN);
  966.     Panel panel2;
  967.     panel2.init(294,266,153,50,IN,THIN);
  968.     panel1.show();
  969.     panel2.show();
  970.  
  971.     Button button1;
  972.     button1.init(424,162,"button",IMAGE);
  973.     Button OK;
  974.     OK.init(305,280,"  OK  ",TEXT);
  975.     Button CANCEL;
  976.     CANCEL.init(378,280,"CANCEL",TEXT);
  977.     button1.show();
  978.     OK.show();
  979.     CANCEL.show();
  980.  
  981.     Gstring name;
  982.     name.init(281,213,20,0);
  983.     Gstring cont;
  984.     cont.init(281,244,20,0);
  985.     name.show();
  986.     cont.show();
  987.  
  988.     Gradio text;
  989.     text.init(210,277,"Text");
  990.     Gradio img;
  991.     img.init(210,297,"Image");
  992.     text.show();
  993.     img.show();
  994.     text.check();
  995.  
  996.     Gtext text1;
  997.     text1.init(279,170,"New Button",15,3,1);
  998.     Gtext text2;
  999.     text2.init(223,210,"Name:",0,3,1);
  1000.     Gtext text3;
  1001.     text3.init(192,241,"Contents:",0,3,1);
  1002.     text1.show();
  1003.     text2.show();
  1004.     text3.show();
  1005.  
  1006.     Line lines[2];
  1007.     lines[0].init(189,195,448,195,8,1);
  1008.     lines[1].init(189,196,448,196,15,1);
  1009.     for(int numlines=0;numlines<2;numlines++)
  1010.         lines[numlines].show();
  1011.  
  1012.     name.get_form_mouse_input();
  1013.     if(name.escapehit()) {
  1014.         redraw_screen();
  1015.         return;
  1016.         }
  1017.  
  1018.     cont.get_form_mouse_input();
  1019.     if(cont.escapehit()) {
  1020.         redraw_screen();
  1021.         return;
  1022.         }
  1023.  
  1024.     while(!ready) {
  1025.         if(the_mouse.LBP()) {
  1026.             if(name.hit()) {
  1027.                 while(the_mouse.LBP());
  1028.                 name.get_form_mouse_input();
  1029.                 }
  1030.             if(cont.hit()) {
  1031.                 while(the_mouse.LBP());
  1032.                 cont.get_form_mouse_input();
  1033.                 }
  1034.             if(text.hit()) {
  1035.                 if(!text.is_checked()) {
  1036.                     text.check();
  1037.                     img.uncheck();
  1038.                     while(the_mouse.LBP());
  1039.                     }
  1040.                 }
  1041.             if(img.hit()) {
  1042.                 if(!img.is_checked()) {
  1043.                     img.check();
  1044.                     text.uncheck();
  1045.                     while(the_mouse.LBP());
  1046.                     }
  1047.                 }
  1048.             if(OK.hit()) {
  1049.                 OK.press();
  1050.                 while(the_mouse.LBP() && OK.hit());
  1051.                 OK.show();
  1052.                 if(OK.hit()) {
  1053.                     box.hide();
  1054.                     box.elim();
  1055.                     ready=1;
  1056.                     }
  1057.                 }
  1058.             if(CANCEL.hit()) {
  1059.                 CANCEL.press();
  1060.                 while(the_mouse.LBP() && CANCEL.hit());
  1061.                 CANCEL.show();
  1062.                 if(CANCEL.hit()) {
  1063.                     box.hide();
  1064.                     box.elim();
  1065.                     return;
  1066.                     }
  1067.                 }
  1068.             }
  1069.         }
  1070.     if(buttonroot==(buttonrec *)NULL) {
  1071.         buttonroot=new buttonrec;
  1072.         buttonroot->previous=buttonroot->next=(buttonrec *)NULL;
  1073.         buttonroot->button=new Button;
  1074.         currentbutton=buttonroot;
  1075.         }
  1076.     else {
  1077.         currentbutton=buttonroot;
  1078.         while(currentbutton->next!=(buttonrec *)NULL)
  1079.             currentbutton=currentbutton->next;
  1080.         currentbutton->next=new buttonrec;
  1081.         currentbutton->next->previous=currentbutton;
  1082.         currentbutton->next->next=(buttonrec *)NULL;
  1083.         currentbutton=currentbutton->next;
  1084.         currentbutton->button=new Button;
  1085.         }
  1086.  
  1087.     strcpy(currentbutton->name,name.getstring());
  1088.     strcpy(currentbutton->text,cont.getstring());
  1089.  
  1090.     if(text.is_checked())
  1091.         currentbutton->format=TEXT;
  1092.     else
  1093.         currentbutton->format=IMAGE;
  1094.  
  1095.     the_mouse.changeto(CROSSHAIR);
  1096.  
  1097.     while(!the_mouse.LBP());
  1098.     int mx=the_mouse.mx();
  1099.     int my=the_mouse.my();
  1100.     if(text.is_checked())
  1101.         currentbutton->button->init(mx,my,cont.getstring(),TEXT,SAVEBGD);
  1102.     else
  1103.         currentbutton->button->init(mx,my,cont.getstring(),IMAGE,SAVEBGD);
  1104.     currentbutton->button->show();
  1105.     numbuttons++;
  1106. }
  1107.  
  1108. //*********************************************************************
  1109. //        PLACE_LINE
  1110. //*********************************************************************
  1111.  
  1112. void place_line()
  1113. {
  1114.     Bevel box;
  1115.     Colorbutton cb[16];
  1116.     Gradio thick,thin;
  1117.     Button OK;
  1118.     int ready=0;
  1119.     int lastx,lasty,mx,my;
  1120.     static int c=1;
  1121.     int s,rootx,rooty,endx,endy;
  1122.     int i;
  1123.  
  1124.     box.init(200,100,202,120,THICK,SAVEBGD);
  1125.     box.setbevelcolor(3);
  1126.     box.show();
  1127.     for(i=0;i<16;i++) {
  1128.         cb[i].init((10*i)+220,120,10,10,i);
  1129.         cb[i].show(0);
  1130.         }
  1131.     cb[c].show(15);
  1132.     thick.init(280,140,"Thick");
  1133.     thick.setbgd(3);
  1134.     thin.init(280,160,"Thin");
  1135.     thin.setbgd(3);
  1136.     thick.show();
  1137.     thin.show();
  1138.     thick.check();
  1139.     OK.init(275,185,"  OK  ",TEXT);
  1140.     OK.show();
  1141.  
  1142.  
  1143.     while(!ready) {
  1144.         if(the_mouse.LBP()) {
  1145.             for(i=0;i<16;i++) {
  1146.                 if(cb[i].hit()) {
  1147.                     cb[c].show(0);
  1148.                     cb[i].show(15);
  1149.                     c=i;
  1150.                     while(the_mouse.LBP());
  1151.                     }
  1152.                 }
  1153.             if(thick.hit()) {
  1154.                 if(!thick.is_checked()) {
  1155.                     thick.check();
  1156.                     thin.uncheck();
  1157.                     }
  1158.                 }
  1159.             if(thin.hit()) {
  1160.                 if(!thin.is_checked()) {
  1161.                     thin.check();
  1162.                     thick.uncheck();
  1163.                     }
  1164.                 }
  1165.             if(OK.hit()) {
  1166.                 OK.press();
  1167.                 while(the_mouse.LBP() && OK.hit());
  1168.                 OK.show();
  1169.                 if(OK.hit())
  1170.                     ready=1;
  1171.                 }
  1172.             }
  1173.         }
  1174.     while(the_mouse.LBP());
  1175.  
  1176.     if(thin.is_checked())
  1177.         s=1;
  1178.     else
  1179.         s=3;
  1180.  
  1181.     redraw_screen();
  1182.     the_mouse.changeto(DOT);
  1183.  
  1184.     while(!the_mouse.LBP());
  1185.     mx=lastx=rootx=the_mouse.mx();
  1186.     my=lasty=rooty=the_mouse.my();
  1187.  
  1188.     setwritemode(XOR_PUT);
  1189.     setcolor(15);
  1190.     setlinestyle(1,0,s);
  1191.     the_mouse.hide();
  1192.     line(lastx,lasty,mx,my);
  1193.     the_mouse.show();
  1194.     while(the_mouse.LBP()) {
  1195.         if(the_mouse.mx()!=mx || the_mouse.my()!=my) {
  1196.             if(ctrlkey())
  1197.                 the_mouse.position(the_mouse.mx(),my);
  1198.             if(altkey())
  1199.                 the_mouse.position(mx,the_mouse.my());
  1200.             the_mouse.hide();
  1201.             line(lastx,lasty,mx,my);
  1202.             line(lastx,lasty,the_mouse.mx(),the_mouse.my());
  1203.             the_mouse.show();
  1204.             mx=the_mouse.mx();
  1205.             my=the_mouse.my();
  1206.             }
  1207.         }
  1208.     endx=mx;
  1209.     endy=my;
  1210.     line_info[numlines].init(rootx,rooty,endx,endy,c,s);
  1211.     line_info[numlines].show();
  1212.     numlines++;
  1213. }
  1214.  
  1215. //*********************************************************************
  1216. //        PLACE_TEXT
  1217. //*********************************************************************
  1218.  
  1219. void place_text()
  1220. {
  1221.     int ready=0;
  1222.     Colorbutton fg[16],bg[16];
  1223.     static int fgd=0;
  1224.     static int bgd=7;
  1225.  
  1226.     Bevel box;
  1227.     box.init(89,120,461,238,THICK,SAVEBGD);
  1228.     box.setbevelcolor(3);
  1229.     box.show();
  1230.  
  1231.     Panel panel1;
  1232.     panel1.init(114,253,106,71,IN,THIN);
  1233.     Panel panel2;
  1234.     panel2.init(276,302,230,39,IN,THIN);
  1235.     panel1.show();
  1236.     panel2.show();
  1237.  
  1238.     Button button1;
  1239.     button1.init(511,133,"text",IMAGE);
  1240.     Button OK;
  1241.     OK.init(299,312,"   OK   ",TEXT);
  1242.     Button CANCEL;
  1243.     CANCEL.init(411,312," CANCEL ",TEXT);
  1244.     button1.show();
  1245.     OK.show();
  1246.     CANCEL.show();
  1247.  
  1248.     Gstring name;
  1249.     name.init(206,189,20,0);
  1250.     Gstring cont;
  1251.     cont.init(206,218,40,0);
  1252.     name.show();
  1253.     cont.show();
  1254.  
  1255.     Gradio small;
  1256.     small.init(130,261,"Small");
  1257.     Gradio med;
  1258.     med.init(130,283,"Medium");
  1259.     Gradio large;
  1260.     large.init(130,304,"Large");
  1261.     small.show();
  1262.     med.show();
  1263.     large.show();
  1264.     small.check();
  1265.  
  1266.     Gtext text1;
  1267.     text1.init(283,135,"New Gtext",15,3,1);
  1268.     Gtext text2;
  1269.     text2.init(148,187,"Name:",0,3,1);
  1270.     Gtext text3;
  1271.     text3.init(117,215,"Contents:",0,3,1);
  1272.     text1.show();
  1273.     text2.show();
  1274.     text3.show();
  1275.  
  1276.     Line lines[2];
  1277.     lines[0].init(105,163,531,163,8,1);
  1278.     lines[1].init(105,164,531,164,15,1);
  1279.     for(int numlines=0;numlines<2;numlines++)
  1280.         lines[numlines].show();
  1281.  
  1282.     for(int i=0;i<16;i++) {
  1283.         fg[i].init((10*i)+315,250,10,10,i);
  1284.         fg[i].show(0);
  1285.         bg[i].init((10*i)+315,270,10,10,i);
  1286.         bg[i].show(0);
  1287.         }
  1288.     fg[fgd].show(15);
  1289.     bg[bgd].show(15);
  1290.     setcolor(0);
  1291.     gprintxy(285,251,"FGD");
  1292.     gprintxy(285,271,"BGD");
  1293.  
  1294.     name.get_form_mouse_input();
  1295.     if(name.escapehit()) {
  1296.         redraw_screen();
  1297.         return;
  1298.         }
  1299.  
  1300.     cont.get_form_mouse_input();
  1301.     if(cont.escapehit()) {
  1302.         redraw_screen();
  1303.         return;
  1304.         }
  1305.  
  1306.     while(!ready) {
  1307.         if(the_mouse.LBP()) {
  1308.             for(i=0;i<16;i++) {
  1309.                 if(fg[i].hit()) {
  1310.                     fg[fgd].show(0);
  1311.                     fgd=i;
  1312.                     fg[fgd].show(15);
  1313.                     while(the_mouse.LBP());
  1314.                     }
  1315.                 if(bg[i].hit()) {
  1316.                     bg[bgd].show(0);
  1317.                     bgd=i;
  1318.                     bg[bgd].show(15);
  1319.                     while(the_mouse.LBP());
  1320.                     }
  1321.                 }
  1322.             if(name.hit()) {
  1323.                 while(the_mouse.LBP());
  1324.                 name.get_form_mouse_input();
  1325.                 if(name.escapehit()) {
  1326.                     redraw_screen;
  1327.                     return;
  1328.                     }
  1329.                 }
  1330.             if(cont.hit()) {
  1331.                 while(the_mouse.LBP());
  1332.                 cont.get_form_mouse_input();
  1333.                 if(cont.escapehit()) {
  1334.                     redraw_screen();
  1335.                     return;
  1336.                     }
  1337.                 }
  1338.             if(small.hit()) {
  1339.                 if(!small.is_checked()) {
  1340.                     small.check();
  1341.                     med.uncheck();
  1342.                     large.uncheck();
  1343.                     }
  1344.                 while(the_mouse.LBP());
  1345.                 }
  1346.             if(med.hit()) {
  1347.                 if(!med.is_checked()) {
  1348.                     med.check();
  1349.                     small.uncheck();
  1350.                     large.uncheck();
  1351.                     }
  1352.                 while(the_mouse.LBP());
  1353.                 }
  1354.             if(large.hit()) {
  1355.                 if(!large.is_checked()) {
  1356.                     large.check();
  1357.                     small.uncheck();
  1358.                     med.uncheck();
  1359.                     }
  1360.                 while(the_mouse.LBP());
  1361.                 }
  1362.             if(OK.hit()) {
  1363.                 OK.press();
  1364.                 while(the_mouse.LBP() && OK.hit());
  1365.                 OK.show();
  1366.                 if(OK.hit()) {
  1367.                     ready=1;
  1368.                     box.hide();
  1369.                     box.elim();
  1370.                     continue;
  1371.                     }
  1372.                 }
  1373.             if(CANCEL.hit()) {
  1374.                 CANCEL.press();
  1375.                 while(the_mouse.LBP() && CANCEL.hit());
  1376.                 CANCEL.show();
  1377.                 if(CANCEL.hit()) {
  1378.                     box.hide();
  1379.                     box.elim();
  1380.                     return;
  1381.                     }
  1382.                 }
  1383.             }
  1384.         }
  1385.     if(textroot==(textrec *)NULL) {
  1386.         textroot=new textrec;
  1387.         textroot->previous=textroot->next=(textrec *)NULL;
  1388.         textroot->text=new Gtext;
  1389.         currenttext=textroot;
  1390.         }
  1391.     else {
  1392.         currenttext=textroot;
  1393.         while(currenttext->next!=(textrec *)NULL)
  1394.             currenttext=currenttext->next;
  1395.         currenttext->next=new textrec;
  1396.         currenttext->next->previous=currenttext;
  1397.         currenttext->next->next=(textrec *)NULL;
  1398.         currenttext=currenttext->next;
  1399.         currenttext->text=new Gtext;
  1400.         }
  1401.  
  1402.     strcpy(currenttext->name,name.getstring());
  1403.     strcpy(currenttext->txt,cont.getstring());
  1404.  
  1405.     if(small.is_checked())
  1406.         currenttext->sz=1;
  1407.     else
  1408.     if(med.is_checked())
  1409.         currenttext->sz=2;
  1410.     else
  1411.     if(large.is_checked())
  1412.         currenttext->sz=3;
  1413.  
  1414.     the_mouse.changeto(CROSSHAIR);
  1415.  
  1416.     while(!the_mouse.LBP());
  1417.     int mx=the_mouse.mx();
  1418.     int my=the_mouse.my();
  1419.     currenttext->text->init(mx,my,cont.getstring(),fgd,bgd,currenttext->sz,SAVEBGD);
  1420.     currenttext->text->show();
  1421.     numtexts++;
  1422. }
  1423.